import { Injectable } from '@angular/core';
import { HttpService } from '../HTTP/http.service';
import { HttpParams } from '@angular/common/http';

import { authorizeAppApirequestInterface } from './interface/authorizeapp.apirequest.interface';
@Injectable()
export class AuthorizedAppApirequest implements authorizeAppApirequestInterface {

  async getAuthorizedApp(userId?: string): Promise<any> {
    if (userId)
      return this.http.get('/api/app/authorize/user', { userId });
    else
      return this.http.get('/api/app/authorize/user');
  }

  async updateAuthorizedApp(UserId: string, AppIds: string[]): Promise<any> {
    return this.http.post('/api/app/authorize/Update', { UserId, AppIds });
  }

  constructor(private http: HttpService) {
  }

}